﻿/* **
 * WebQ - a Web Questionare / Survey Framework
 * Andrew Adhi Ariane Murniadi / 2009
 * GPL
 * $Id$
 *									** */

using System;
using System.Collections.Generic;
using System.Text;
using WebQ.Core;
using System.Web.UI.WebControls;
using System.ComponentModel;

namespace WebQ {
	/// <summary>
	/// Facade. This class is used to simplify QAItem and Visualizer Configuration management and
	/// for providing a single common entity where the designer editor can work with
	/// </summary>
	public class WebQEntity {
		private WebQQAItem m_qaItem = null;
		private WebQVisualizerConfiguration m_configuration = null;

		[Browsable ( false )]
		public WebQQAItem QAItem {
			get { return m_qaItem; }
		}

		[Browsable ( true )]
		public String QAId {
			get { return m_qaItem.Id; }
			set { m_qaItem.Id = value; }
		}

		[Browsable ( true )]
		public String QuestionString {
			get { return m_qaItem.QuestionString; }
			set { m_qaItem.QuestionString = value; }
		}
		
		[Browsable ( false )]
		public WebQVisualizerConfiguration Configuration {
			get { return m_configuration; }
		}

		[Browsable ( true )]
		public Boolean IsRequired {
			get { return m_configuration.IsRequired; }
			set { m_configuration.IsRequired = value; }
		}

		[Browsable ( true )]
		public WebQVisualizerType VisualizerType {
			get { return m_configuration.VisualizerType; }
			set { m_configuration.VisualizerType = value; }
		}

		public WebQEntity ( WebQQAItem item, WebQVisualizerConfiguration configuration ) {
			m_qaItem = item;
			m_configuration = configuration;
		}

		public WebQEntity () {
			m_qaItem = new WebQQAItem ( "" );
			m_configuration = new WebQVisualizerConfiguration ();
		}
	}
}
